﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using LeadTeam.Exam.Entities;

namespace LeadTeam.Exam.DataSevice
{
    public class InitializtionExamDB : DropCreateDatabaseIfModelChanges<LeadTeam.Exam.DbContext.DbContext>
    {
        protected override void Seed(DbContext.DbContext context)
        {
            base.Seed(context);

            var organizations = new List<Organizations>
            { 
                new Organizations{
                   O_NAME="Root",
                   O_DESC="RootOrg",
                   O_CREATE= DateTime.Now,
                    O_ID=1,
                    O_PARENT_ID=0
                },

                  new Organizations{
                   O_NAME="HR",
                   O_DESC="HR",
                   O_CREATE= DateTime.Now,
                    O_ID=2,
                    O_PARENT_ID=1
                },

                  new Organizations{
                   O_NAME="Sales",
                   O_DESC="Sales",
                   O_CREATE= DateTime.Now,
                    O_ID=3,
                    O_PARENT_ID=1
                },

                 new Organizations{
                   O_NAME="Marketing",
                   O_DESC="Marketing",
                   O_CREATE= DateTime.Now,
                    O_ID=4,
                    O_PARENT_ID=1
                },

                  new Organizations{
                   O_NAME="Salary(HR)",
                   O_DESC="Salary(HR)",
                   O_CREATE= DateTime.Now,
                    O_ID=4,
                    O_PARENT_ID=1
                }
            };

            organizations.ForEach(d => context.Organizations.Add(d));
        }
    }
}